All Questions
8 questions
3votes
5answers
756views
How can I reformat blocks of data until the end of the file is reached?
I have a file that looks like this: # Time-averaged data for fix avetimeall # TimeStep Number-of-rows # Row c_gyrationchunkall 1000 3 1 2.09024e-14 2 4.88628 3 5.69321 2000 3 1 2.10518e-14 2 8.33702 3 ...
0votes
1answer
2kviews
how to replace spaces in a string with '\ ' in bash
I'm writing a bash script that prints the contents of a file called website (using cat) that is inside a folder with a space in it's name, for example folder 1. but I can't make bash get the path ...
0votes
1answer
197views
Bash - Convert problematic space-separated table to semicolon-delimeted list
I have a program that outputs many lines of data in a space-separated table. I need to convert this output to a semicolon-separated list. This is an example record. Each field has a set number of ...
0votes
1answer
249views
Remove Strings from two patterns/characters with sed
I want to remove the string inside two patterns/characters, so if I have a file containing "% Blah blah % i want to remove Blah blah as well as the pattern character in this case it will be % %. ...
-1votes
1answer
12kviews
Why does echo -e "\n" give me two blank lines instead of one?
Let's say there's a line "aaaa" in file.txt, and I want to add ONLY ONE blank line after it, and then add a line of text after the blank line. I did: echo -e "\n" >> file.txt echo "bbbb" >> file.txt ...
2votes
0answers
102views
How can I regex match-and-replace _all_ on-screen text?
I need a way to replace an on-screen pattern with another string, regardless of what places that text on the screen. Maybe I can live without user input being replaced, but anything that comes from ...
3votes
0answers
89views
Git - prune every whitespace-separated word originally introduced by specific author in project's history
We have a project under git revision control with only a single branch. We need to remove every new whitespace-separated word that was introduced for the first ever time in a given file by a specific ...
7votes
3answers
2kviews
Format column-based text file into tree structure using bash
Is there a Unix/Linux command that can turn this: AMERICA USA NEW_YORK AB-100 AMERICA USA NEW_YORK VF-200 AMERICA USA NEW_YORK XY-243 AMERICA USA LOS_ANGELES UH-198 AMERICA CANADA TORONTO ...